package com.trkj.dao.wxy;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojo.QuestionBank;
import com.trkj.vo.wxy.QuestionBankPageVo;

public interface QuestionBankDao extends CrudRepository<QuestionBank, Long> {
	//模糊查询
	@Query(nativeQuery=true,value="select * from QUESTION_BANK q where q.QU_NAME like ?1 or q.DEFIDE_ID like ?1")
	public List<QuestionBank> queryByeName(String quName);
	
	//多表查询分页
	@Query("select q,d from QuestionBank q inner join q.definitionDept d")
	public List<Object[]> queryByQuestion(Pageable p);
	
	//排序
	@Query("from QuestionBank q order by q.quDate desc")
	public List<QuestionBank> queryByQuDate();
	
	//单表分页
	@Query("from QuestionBank e")
	public List<QuestionBank> queryByPage(Pageable p);
}
